//
//  MyGoodsOfferInforTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/3.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "MyGoodsOfferInforTableViewCell.h"
#import "MyOfferGoodsView.h"

@interface MyGoodsOfferInforTableViewCell ()
@property (nonatomic,strong) GLGWLabel * stellNameLabel;
@property (nonatomic,strong) GLGWLabel * weightLabel;
@property (nonatomic,strong) GLGWLabel * specLabel;
@property (nonatomic,strong) GLGWLabel * maxPiceLabel;
@property (nonatomic,strong) MyOfferGoodsView * offerGaryView;
@end

@implementation MyGoodsOfferInforTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setSepartionLineWith:lineModel_All];
        self.stellNameLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(16) theColor:kColor_Rule_Black inSuperView:self.contentView];
        self.stellNameLabel.text = @"三级螺纹钢";
        [self.stellNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.contentView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(20));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(22)));
        }];
        //
        self.weightLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#EC5353"] inSuperView:self.contentView];
        self.weightLabel.text = @"50吨";
        self.weightLabel.textAlignment = NSTextAlignmentRight;
        [self.weightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.contentView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(21));
            make.left.equalTo(self.stellNameLabel.mas_right).offset(kWidthProportion_In_iPhoneTriploid(10));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
        }];
        // 设置优先级
        [self.stellNameLabel setContentCompressionResistancePriority:(UILayoutPriorityDefaultLow) forAxis:(UILayoutConstraintAxisHorizontal)];
        [self.weightLabel setContentCompressionResistancePriority:(UILayoutPriorityDefaultHigh) forAxis:(UILayoutConstraintAxisHorizontal)];
        //
        self.specLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:self.contentView];
        self.specLabel.text = @"HRB400E 400*300 河钢";
        [self.specLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.stellNameLabel);
            make.top.equalTo(self.stellNameLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(5));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
        }];
        //
        self.maxPiceLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#EC5353"] inSuperView:self.contentView];
        self.maxPiceLabel.textAlignment = NSTextAlignmentRight;
        self.maxPiceLabel.text = @"最高5000元/吨";
        [self.maxPiceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.specLabel.mas_right).offset(kWidthProportion_In_iPhoneTriploid(10));
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.weightLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(6));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
        }];
        // 设置优先级
        [self.specLabel setContentCompressionResistancePriority:(UILayoutPriorityDefaultLow) forAxis:(UILayoutConstraintAxisHorizontal)];
        [self.maxPiceLabel setContentCompressionResistancePriority:(UILayoutPriorityDefaultHigh) forAxis:(UILayoutConstraintAxisHorizontal)];
        //灰色块
        self.offerGaryView = [[MyOfferGoodsView alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(15), kHeightProportion_In_iPhoneTriploid(87), KScreenWidth - kHeightProportion_In_iPhoneTriploid(30), kHeightProportion_In_iPhoneTriploid(135)) inSuperView:self.contentView];
        kWeakSelf(self);
        self.offerGaryView.Block_LookGoodsInfor = ^{
            if (weakself.Block_LookInfor) {
                weakself.Block_LookInfor();
            }
        };
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
